var user = null;

$(function () {

    $.ajax({
        url: '/u/logined',
        type: 'get',
        async:false,
        dataType: 'json',
        success: function (d) {
            if (d.code==0) {
                user = d.user;
            }
        }
    });
})

function logined() {
    if(!user){
        return false;
    }
    return true;
}

function showLogin() {
    var modal = $(".cd-user-modal");
    $(".js-show-menu >ul").css({"display": "none"});
    modal.addClass("is-visible");
    modal.find("#cd-signup").css({"display": "none"});
    modal.find("#cd-forgetpwd").css({"display": "none"});
    modal.find("#cd-login").css({"display": "block"});
}
